<%= form_for @event || Event.new(:owner_id => profile_or_current_subject.actor_id, :interval => 1), :remote => true do |f| %>
  <%= f.hidden_field :owner_id  %>
  <%= f.hidden_field :start_at %>
  <%= f.hidden_field :end_at %>
  <%= f.hidden_field :all_day %>

  <% if f.object.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(f.object.errors.count, "error") %> evitaron que se guardara esta actividad:</h2>

      <ul>
      <% f.object.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
<section>
  <%= f.label :title %>
  <%= f.text_field :title %>
</section>
<section>
  <%= f.label :description %>
  <%= f.text_area :description %>
</section>
  <% if f.object.owner.rooms.any? %>
    <section>
    <%= f.label :room %>
    <%= f.select :room_id, f.object.owner.rooms.map{ |r| [r.name, r.id] }, { include_blank: true } %>
    </section>
  <% end %>

  <%= render :partial => 'scheduler/form',
             :locals  => { :f => f } %>

  <%= render partial: 'objects/form_privacy',
             locals: { f: f } %>
  
  <%= f.submit nil %>
<% end %>
